package br.com.scmimebr.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;


@NamedQueries({
	@NamedQuery(name="Dizimo.consultarTodosDizimos",query="select d from Dizimo d")

})
@Entity
@Table(name="dizimo")
public class Dizimo implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="idDizimo" , sequenceName="idDizimo" , allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="idDizimo")
	private long idDizimo;	
	
	@Column(name="valorDizimo")
	private double valorDizimo;
	
	@Column(name="periodoReferente")
	private Date periodoReferente;
	
	
	//********** RELACIONAMENTOS *************************//
	
	@ManyToOne
	@JoinColumn(name="fk_idMembro")
	@Fetch(FetchMode.JOIN)
	@Cascade(CascadeType.REFRESH)
	private Membro membro;
	
	//********** GETTERS AND SETTERS ***********************
	
	public long getIdDizimo() {
		return idDizimo;
	}

	public void setIdDizimo(long idDizimo) {
		this.idDizimo = idDizimo;
	}

	public double getValorDizimo() {
		return valorDizimo;
	}

	public void setValorDizimo(double valorDizimo) {
		this.valorDizimo = valorDizimo;
	}

	public Date getPeriodoReferente() {
		return periodoReferente;
	}

	public void setPeriodoReferente(Date periodoReferente) {
		this.periodoReferente = periodoReferente;
	}

	public Membro getMembro() {
		return membro;
	}

	public void setMembro(Membro membro) {
		this.membro = membro;
	}

	//********** GETTERS AND SETTERS ***********************
	
}
